import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';
import { dropdownDividerDefaultProps } from './defaultProps';
import type { DropdownDividerOptions } from './type';

export interface DropdownDividerProps extends DropdownDividerOptions, HTMLAttributes<HTMLDivElement> {}

const DropdownDivider: FC<DropdownDividerProps> = (props) => {
  const { className, ui, children, forwardedRef, ...dropdownDividerProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames({ ui }, 'divider', className), ...dropdownDividerProps },
    children,
  );
};

DropdownDivider.displayName = 'DropdownDivider';
DropdownDivider.defaultProps = dropdownDividerDefaultProps;

export default DropdownDivider;
